package es.titoapps.spanishhandball.animations;

import es.titoapps.spanishhandball.R;

import android.content.Context;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;

public class Animations {
	
	public static View myLayout=null;
	
	public static void startAnimationComeUp(View layout, int layoutid,Context context) {         
	    myLayout = (View) layout.findViewById(layoutid);
	    
	    Animation animation = AnimationUtils.loadAnimation(context,R.anim.comeup_anim);

	    animation.setAnimationListener(animationListener);

	    myLayout.clearAnimation();
	    myLayout.startAnimation(animation);
	}
	
	public static void startAnimationComeDown(View layout, int layoutid,Context context) {         
		myLayout = (View) layout.findViewById(layoutid);

	    Animation animation = AnimationUtils.loadAnimation(context,R.anim.comedown_anim);

	    animation.setAnimationListener(animationListener);

	    myLayout.clearAnimation();
	    myLayout.startAnimation(animation);
	}
	
	public static void startAnimationFadeOut(View layout, int layoutid,Context context) {         
		myLayout = (View) layout.findViewById(layoutid);

	    Animation animation = AnimationUtils.loadAnimation(context,android.R.anim.fade_out);

	    animation.setAnimationListener(animationListener);

	    myLayout.clearAnimation();
	    myLayout.startAnimation(animation);
	}
	
	private static AnimationListener animationListener=new AnimationListener() {
		
		@Override
		public void onAnimationStart(Animation animation) {
			// TODO Auto-generated method stub
			
		}
		
		@Override
		public void onAnimationRepeat(Animation animation) {
			// TODO Auto-generated method stub
			
		}
		
		@Override
		public void onAnimationEnd(Animation animation) {
			
		
		}
	};

}
